<?php
include("../include/config.inc.php");

$id=$_REQUEST["id"];
if(!CheckId($id))
{
	PhpBox("参数错误");
	GotoPage("h");
	exit();
}
$sql="SELECT * FROM ".tableprefix."store where store_id='$id'";
$result=$db->query($sql);
$store=$db->fetch_array($result);
$store_id=$store["store_id"];
$grade_id=$store["grade_id"];
if($grade_id=='2'){
$temp_store_credit='诚信商户';
}elseif($grade_id=='3'){
$temp_store_credit='特约商户';
}else{
$temp_store_credit='普通商户';
}

$sql = "select count(*) as count from ".tableprefix."collection where classify='store' and store_id='$store_id'";
$rs=$db->fetch_array($db->query($sql));

$consql.="and store_id='$id' order by goods_id desc";
$sql = "select count(*) as count from ".tableprefix."goods where 1=1 ".$consql;
$row=$db->fetch_array($db->query($sql));
$count=$row["count"];
$page=new ShowPage;
$page->PageSize=20;
$page->Total=$count;
$page->LinkAry = array("id"=>$id);
$sql="select * from ".tableprefix."goods where 1=1 ".$consql." limit ".$page->OffSet();
$result=$db->query($sql);
$showpage= $page->ShowLink();
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>全部演出 - 订戏会</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=9,Chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<link rel="stylesheet" type="text/css" href="../css/public.css">
<link rel="stylesheet" type="text/css" href="../css/store.css">
<script type="text/javascript" src="../js/clientwidth.js"></script>
</head>
<body>
<div id="storebanner" style="background:url(../images/personal.png) no-repeat;background-size:640px;">
	<div class="storelogo"><img src="<?php if($row["store_label"]==''){echo "../images/storenav_01.jpg";}else{echo "../".$row['store_label'];}?>"></div>
	<div class="storename"><?php echo $store["store_name"];?><span><?php echo $temp_store_credit;?></span></div>
	<a href="../api/collection.php?a=store&storeid=<?php echo $row["store_id"];?>"><div class="guanzhu"><?php echo $rs["count"];?><br>关注</div></a>
</div>
<div id="storenav">
	<ul>
		<a href="index.php?id=<?php echo $id;?>">
		<li>
			<i><img src="../images/storenav_01.jpg"></i>
			<span>商家首页</span>
		</li>
		</a>
		<a href="list.php?id=<?php echo $id;?>">
		<li>
			<i><img src="../images/storenav_02.jpg"></i>
			<span>全部演出</span>
		</li>
		</a>
		<a href="paiqi.php?id=<?php echo $id;?>">
		<li>
			<i><img src="../images/storenav_03.jpg"></i>
			<span>演出排期</span>
		</li>
		</a>
		<a href="news.php?id=<?php echo $id;?>">
		<li>
			<i><img src="../images/storenav_04.jpg"></i>
			<span>商家活动</span>
		</li>
		</a>
		<a href="aboutus.php?id=<?php echo $id;?>">
		<li>
			<i><img src="../images/storenav_05.jpg"></i>
			<span>商家简介</span>
		</li>
		</a>
	</ul>
</div>
<div id="storelist2">
<?php     
if($count>0){
?>
	<ul>
<?php
while($row = $db->fetch_array($result))
{
?>
		<li>
		<a href="../goods.php?id=<?php echo $row["goods_id"];?>">
			<img src="../<?php echo $row["goods_image"];?>">
			<div>
				<h1><?php echo $row["goods_name"];?></h1>
				<i>价格：<font style="color:#FF0000;margin-right:5px;"><?php echo $row["goods_price"];?></font>元</i>
				<em>订金：<font style="color:#FF0000;margin-right:5px;"><?php echo $row["book_down_payment"];?></font>元</em>
			</div>
		</a>
		</li>
<?php
}
?>
	</ul>
	<div class="pages" style="margin-bottom:50px"><?php echo $showpage;?></div>
<?php
}else{
echo "<div style='padding:50px 0px;text-align:center;color:#990000;font-size:12px;'>没有找到合乎条件的记录</div>";
}
?>
</div>

<div id="bottom"></div>

<footer id="bar-fixed">
	<a href="../" class="tab-item"><i class="icon-tabbar bar-home"></i>首页</a>
	<a href="../category.php" class="tab-item"><i class="icon-tabbar bar-message"></i>分类</a>
	<a href="../publish/" class="tab-item"><i class="icon-tabbar bar-publish"></i>发起</a>	
	<a href="../user/" class="tab-item active"><i class="icon-tabbar bar-user2"></i>我</a>
</footer>
<script>
if (document.body.clientWidth > 640) {
	$('body').css({
		width: 640,
		margin: '0 auto',
	});
}
</script>
</body>
</html>
<?php
$db->free_result($result);
$db->close();
exit;
?>